/**
 * 
 */
package com.bolbachchan.blog.domain;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * @author Chaitanya
 * 
 */
@Entity
@Table(name = "SECURITY_QUESTIONS")
public class SecurityQuestions implements Serializable {

    /**
	 * 
	 */
    private static final long serialVersionUID = -4437064170505293941L;

    private int objId;
    private int questionTypeId;
    private String question;
    private char activeFlg;
    private Timestamp createDt;
    private Timestamp updateDt;

    private Set<SecurityAnswers> securityAnswers = new HashSet<SecurityAnswers>();

    /**
     * @return the objId
     */
    @Id
    @Column(name = "OBJ_ID")
    public int getObjId() {
	return objId;
    }

    /**
     * @param objId
     *            the objId to set
     */
    public void setObjId(int objId) {
	this.objId = objId;
    }

    /**
     * @return the questionTypeId
     */
    @Column(name = "QUESTION_TYPE_ID")
    public int getQuestionTypeId() {
	return questionTypeId;
    }

    /**
     * @param questionTypeId
     *            the questionTypeId to set
     */
    public void setQuestionTypeId(int questionTypeId) {
	this.questionTypeId = questionTypeId;
    }

    /**
     * @return the question
     */
    @Column(name = "QUESTION")
    public String getQuestion() {
	return question;
    }

    /**
     * @param question
     *            the question to set
     */
    public void setQuestion(String question) {
	this.question = question;
    }

    /**
     * @return the activeFlg
     */
    @Column(name = "ACTIVE_FLG")
    public char getActiveFlg() {
	return activeFlg;
    }

    /**
     * @param activeFlg
     *            the activeFlg to set
     */
    public void setActiveFlg(char activeFlg) {
	this.activeFlg = activeFlg;
    }

    /**
     * @return the createDt
     */
    @Column(name = "CREATE_DT")
    public Timestamp getCreateDt() {
	return createDt;
    }

    /**
     * @param createDt
     *            the createDt to set
     */
    public void setCreateDt(Timestamp createDt) {
	this.createDt = createDt;
    }

    /**
     * @return the updateDt
     */
    @Column(name = "UPDATE_DT")
    public Timestamp getUpdateDt() {
	return updateDt;
    }

    /**
     * @param updateDt
     *            the updateDt to set
     */
    public void setUpdateDt(Timestamp updateDt) {
	this.updateDt = updateDt;
    }

    /**
     * @return the securityAnswers
     */
    @OneToMany(mappedBy = "securityQuestions")
    public Set<SecurityAnswers> getSecurityAnswers() {
	return securityAnswers;
    }

    /**
     * @param securityAnswers
     *            the securityAnswers to set
     */
    public void setSecurityAnswers(Set<SecurityAnswers> securityAnswers) {
	this.securityAnswers = securityAnswers;
    }

    /*
     * (non-Javadoc)
     * @see java.lang.Object#hashCode()
     
    @Override
    public int hashCode() {
	final int prime = 31;
	int result = 1;
	result = prime * result + activeFlg;
	result = prime * result + ((createDt == null) ? 0 : createDt.hashCode());
	result = prime * result + objId;
	result = prime * result + ((question == null) ? 0 : question.hashCode());
	result = prime * result + questionTypeId;
	result = prime * result + ((securityAnswers == null) ? 0 : securityAnswers.hashCode());
	result = prime * result + ((updateDt == null) ? 0 : updateDt.hashCode());
	return result;
    }

    
     * (non-Javadoc)
     * @see java.lang.Object#equals(java.lang.Object)
     
    @Override
    public boolean equals(Object obj) {
	if (this == obj)
	    return true;
	if (obj == null)
	    return false;
	if (getClass() != obj.getClass())
	    return false;
	SecurityQuestions other = (SecurityQuestions) obj;
	if (activeFlg != other.activeFlg)
	    return false;
	if (createDt == null) {
	    if (other.createDt != null)
		return false;
	}
	else if (!createDt.equals(other.createDt))
	    return false;
	if (objId != other.objId)
	    return false;
	if (question == null) {
	    if (other.question != null)
		return false;
	}
	else if (!question.equals(other.question))
	    return false;
	if (questionTypeId != other.questionTypeId)
	    return false;
	if (securityAnswers == null) {
	    if (other.securityAnswers != null)
		return false;
	}
	else if (!securityAnswers.equals(other.securityAnswers))
	    return false;
	if (updateDt == null) {
	    if (other.updateDt != null)
		return false;
	}
	else if (!updateDt.equals(other.updateDt))
	    return false;
	return true;
    }*/

    /*
     * (non-Javadoc)
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
	return "SecurityQuestions [objId=" + objId + ", questionTypeId=" + questionTypeId + ", question=" + question
		+ ", activeFlg=" + activeFlg + ", createDt=" + createDt + ", updateDt=" + updateDt
		+ ", securityAnswers=" + securityAnswers + "]";
    }
}
